-
Notifications
You must be signed in to change notification settings - Fork 0
✨ Add migration from helm to boxcutter revision #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
63ad1ed to
4ad5221
Compare
| x-kubernetes-embedded-resource: true | ||
| x-kubernetes-preserve-unknown-fields: true | ||
| required: | ||
| - collisionProtection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If collisionProtection has a default ("Prevent"), it doesn't seem like it also makes sense to be required?
86bc6d7 to
34eafee
Compare
| // +kubebuilder:validation:Enum=Active;Paused;Archived | ||
| // +kubebuilder:validation:XValidation:rule="oldSelf == 'Active' || oldSelf == 'Paused' || oldSelf == 'Archived' && oldSelf == self", message="can not un-archive" | ||
| LifecycleState ClusterExtensionRevisionLifecycleState `json:"lifecycleState,omitempty"` | ||
| // Revision number orders changes over time, must always be previous revision +1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get what we're trying to say with "Revision number orders changes over time". Maybe just "Revision number changes over time"? Maybe "Revision provides historical ordering of revisions, must always be previous +1"?
| return fmt.Errorf("unable to create helm action client getter: %w", err) | ||
| } | ||
|
|
||
| // TODO: add support for preflight checks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this TODO still valid?
|
|
||
| type ClusterExtensionRevisionGenerator interface { | ||
| GenerateRevision(bundleFS fs.FS, ext *ocv1.ClusterExtension, objectLabels, revisionAnnotations map[string]string) (*ocv1.ClusterExtensionRevision, error) | ||
| GenerateRevisionFromHelmRelease( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we be mixing concerns here? Maybe we could use generics in the interface to define the input type? (e.g. helmRelease vs bundleFS)?
| }) | ||
| } | ||
|
|
||
| rev := r.buildClusterExtensionRevision(objs, ext, map[string]string{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could make this a revision generator and then just use composition for the bundle and helm release generators....wdyt?
| } | ||
|
|
||
| func Test_SimpleRevisionGenerator_Success(t *testing.T) { | ||
| func Test_SimpleRevisionGenerator_GenerateRevisionFromHelmRelease(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
separating the Objects -> Revision, Bundle -> Revision and Chart -> Revision + composition (e.g. Objects -> Revision being used in Chart -> Revision) might also facilitate testing here since we'd only need to test the integration between the chart -> revision and objects -> revision (i.e. that we extract the correct objects from the chart and pass it down). This could help save us time later on as we iterate over the objects to revision process.
| client.AssertExpectations(t) | ||
| }) | ||
|
|
||
| t.Run("does not create revision when revisions exist", func(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could the title be wrong here? We aren't returning any revisions
| ObjectMeta: metav1.ObjectMeta{Name: "test123"}, | ||
| } | ||
|
|
||
| client. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible to check that client.Client was not called?
| }, | ||
| } | ||
|
|
||
| // TODO: we should make constants for the ClusterExtensionRevision condition types. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worth doing already? XD
6d7efbf to
7e4f03b
Compare
34eafee to
8d7de9a
Compare
Description
Reviewer Checklist